<?php
/**
  * @Author     liangjinying
  * @Date       2015-1-14
  * @Encoding   UTF-8
  * Descript    Please Type In
  **/
class GameTraceController extends AdminBaseController{
	
	public function index(){
		
		$this->setTitle(PubFunc::t('平台跟踪'));
		
		$filter = new PubFilter();
		$grid   = new PubGrid();
		
		$funStati = array(
						'loginSta' => PubFunc::t('登录统计'),
						'paySta'   => PubFunc::t('付费统计')
		);
		
		$objStati = array(
						'OldUser' => PubFunc::t('老用户'),
						'NewUser' => PubFunc::t('新用户'),
					  'CrossUser' => PubFunc::t('跨服用户')
		);
		
		$filter->addPlatformFilter()
				->addServerFilter(true)
				->addFilter('time', 'timerange', PubFunc::t('日期'), array('value' => PubDateRange::getLastDayRange(7, strtotime('yesterday'))))
				->addFilter('funStati', 'select', PubFunc::t('统计功能'), array('options' => $funStati, 'value' => 'loginSta'))
				->addFilter('kpi', 'select', PubFunc::t('统计对象'), array('options' => $objStati, 'value' => 'oldUser'));
		
		$params = $filter->get();
		
		$header  = GameTraceService::getHeader($params);
		$tblData = GameTraceService::getTableData($params, $header); 
		
		$grid->addGrid($header, $tblData, array(
				'name'  => PubFunc::t("平台跟踪"),
			 	'order' => array(
                        array('RecDate', 'desc'),
                    )
		));
		
		$this->out['filter'] = $filter->show();
		$this->out['grid'] = $grid->show();
		
	}
	
}